home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995…tember: Reference Library / Dev.CD Sep 95 RL / Dev.CD Sep 95 RL.toast / mac / Technical Documentation / develop / develop Issue 15 code / 3D Interface / 3D Buttons CDEF / Source / 3D Buttons CDEF source / 3D Buttons CDEF Source Read Me next >
Encoding:
Text File  |  1994-12-06  |  2.9 KB  |  50 lines  |  [TEXT/ttxt]

  1. 3D Buttons CDEF, by Zig Zichterman
  2. 1.0b5 6 December 1994
  3.  
  4. 3D Buttons is a control definition (CDEF) that implements the 3D interface as suggested in develop issue 15. When drawing on a 8-bit (or breater) color device (in a color GrafPort), 3D Buttons draws in grey. 3D Buttons drops to normal 2D drawing for black and white (or less than 8 bits of color).
  5.  
  6. The source for the 3D Buttons CDEF is broken into
  7. •  the main entry function:
  8.       3D Buttons CDEF.cp
  9. •  classes for 4 button variants:
  10.       LGBPushButtons
  11.       LGBCheckbox
  12.       LGBRadio
  13.       LIconButton
  14. •  utility functions:
  15.       LGBColorTable
  16.       LGBControl
  17.       LGBDeviceIterator
  18.       UGBDraw
  19. •  state saver/restorers
  20.       LGBClipRegion
  21.       LGBFont
  22.       LGBPen
  23.  
  24. [The "GB" stands for "Grey Buttons," which is what I originally called the project.]
  25.  
  26. I originally wrote this function in C++, but without any C++ features that require the C++ runtime engine (no destructors, no new) or A4 globals (no virtual). The CDEF was smaller and faster without all that overhead. Now that the CDEF's grown to 16K, I think the CDEF would be significantly smaller if I were to set up A4 and use inheritance, but I'm not blowing a week rewriting this CDEF just to save 8K.
  27.  
  28. Every function call into the CDEF comes through the main entry point in 3D Buttons CDEF.cp. Main() switches on the button variation and passes control to the entry point for one of the 4 button variations.
  29.  
  30. Each button variation has a main entry point that switches on the CDEF message. There are only 4 messages that button CDEFs pay attention to: draw, hit test, and 2 messages to calculate the button region.
  31.  
  32. Most of the code in each button variation is devoted to drawing the buttons. Drawing functions just save the current drawing environment, then loop through the device list, drawing either color or black and white depending on the device (screen) depth.
  33.  
  34. Change History
  35. 1.0b5—06 December 1994
  36. Lots of bug fixes!
  37. Fix useWFont bug—now actually uses window's font.
  38. Save and restore font, pen color, pen state, and clip region across draw.
  39. Clip to intersection of original clip region and device when walking device list.
  40. Honor control and window auxilliary color tables ('cctb', 'wctb' and so on) when drawing inactive/flat controls, background of checkboxes and radio buttons.
  41. Don't force 4 corners of pushbuttons to 0xDDDD.
  42. Also, use classes to save/restore the pen, color, clip region.
  43. 1.0b4—31 July 1994
  44. Bug Fix—save and restore the pen color across draws
  45. Draw 3D buttons on 4-bit devices if those devices are also greyscale, not color.
  46. 1.0b3—29 July 1994
  47. Added offscreen GWorld support so the button titles would stop that annoying flashing. Many thanks to one of my users for pointing it out.
  48. 1.0b2—20 July 1994 (never released)
  49. Call PenNormal() before starting any draw. Alerts would leave the pensize at (2,2) for the default button, which tended to make OK buttons look awful in color.
  50.